<div id="vj_left">
<div class="vj_box_650_tab">
<div class="title_tab_one">
    <a href="#" class="active_tab_one" id="tabone1"
       onclick="change_tg_vn(this.id,'getNewProduct','{$seller}'); return false;">Sản phẩm mới</a>
    <a href="#" id="tabone2" onclick="change_tg_vn(this.id,'getBuyWay','{$seller}'); return false;">Thông tin
        thanh
        toán</a>
    <a href="#" id="tabone4" onclick="change_tg_vn(this.id,'getListGuestBook','{$seller_id}'); return false;">Lưu
        bút</a>

    <?php if (Yii::app()->user->id == $user_id) { ?>
        <a href="#" id="tabone3"
           onclick="change_tg_vn(this.id,'getEditUserInformation','{$seller_id}'); return false;">Thông tin cá
            nhân</a>

    <?php } ?>


</div>
<div class="content_tab_one" id="contenttab1">
    <div id="getNewProduct">
        <div class="vj_tabel_com margin_tow">
            <?php if (Yii::app()->user->id == $user_id) { ?>
                <?php $this->widget('zii.widgets.grid.CGridView', array(
                    'id' => 'product-grid',
                    'enableSorting' => false,
                    'dataProvider' => $products,
                    'columns' => array(
                        array('name' => 'image_id', 'value' => '$data->getPictureHtml()', 'type' => 'raw'),
                        array('name' => 'product_name', 'value' => '$data->getNameHtml()', 'type' => 'raw'),
                        array('name' => 'price', 'value' => '$data->getPrice()'),
                        array('name' => 'location', 'value' => '$data->getLocation()'),
                        array(
                            'class' => 'CButtonColumn',
                            'template' => '{update}',
                            'buttons' => array(
                                'update' => array
                                (
                                    'label' => 'Sửa',
                                    'url' => 'TreTodayUrl::getUpdateProductUrl($data->product_id, $data->product_name)',
                                ))
                        ),
                    ),
                )); ?>
            <?php } else { ?>
                <?php $this->widget('zii.widgets.grid.CGridView', array(
                    'id' => 'product-grid',
                    'enableSorting' => false,
                    'dataProvider' => $products,
                    'columns' => array(
                        array('name' => 'image_id', 'value' => '$data->getPictureHtml()', 'type' => 'raw'),
                        array('name' => 'product_name', 'value' => '$data->getNameHtml()', 'type' => 'raw'),
                        array('name' => 'price', 'value' => '$data->getPrice()'),
                        array('name' => 'location', 'value' => '$data->getLocation()'),
                    ),
                )); ?>
            <?php } ?>

        </div>
    </div>
</div>
<div class="content_tab_two light_height_tab" id="contenttab2">
    <div id="getBuyWay">
        <?php
        echo $buyWay != null ? $buyWay->detail : 'Chưa có thông tin thanh toán' ?>
    </div>

    <?php if (Yii::app()->user->id == $_GET['user_id']) { ?>
        <?php $form = $this->beginWidget('CActiveForm', array(
            'id' => 'news-form',
            'enableAjaxValidation' => true,
            'htmlOptions' => array(
                'role' => 'form',
                'class' => 'form-horizontal',
            ),

        )); ?>
        <table id="tbBuyWay" style="display: none">
            <tr>
                <td>
                    <input type="text" id="txtBuyWay" style="width: 600px" name="buyWay"
                           value="<?php echo $buyWay == null ? "" : $buyWay->detail ?>"></textarea>
                </td>

            </tr>
            <tr>
                <td><input style="padding: 5px" type="submit" value="Lưu" class="btn btn-default"></td>

            </tr>
        </table>

    <?php $this->endWidget(); ?>
        <span id="btnEditBuyWay"
              style="cursor: pointer"><?php echo $buyWay == null ? "Tạo mới" : "Chỉnh sửa" ?></span>
        <script type="text/javascript">
            $('#btnEditBuyWay').click(function () {
                $("#tbBuyWay").toggle();
            });

            KindEditor.ready(function (K) {
                window.editor = K.create('#txtBuyWay', {
                    langType: 'en',
                    resizeMode: 1,
                    height: 500,
                    items: [
                        'bold', 'italic', 'underline',
                        'removeformat', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                        'insertunorderedlist', 'link', 'unlink']
                });
            });

        </script>


    <?php } ?>
</div>

<div class="content_tab_three" id="contenttab4">
    <div id="getListGuestBook">  <?php if ($total > 0) { ?>
            <div id="luubut_detail" class="vj_luubut_detail">

                <?php $this->widget('zii.widgets.CListView', array(
                    'id' => 'guestBook-list',
                    'enableSorting' => false,
                    'dataProvider' => $guestBooks,
                    'itemView' => '_viewGuestBook',
                )); ?>

            </div>
        <?php
        } else {
            echo "Chưa có lưu bút.";
        } ?>
    </div>
</div>
<div class="content_tab_three" id="contenttab3">
    <div id="getEditUserInformation">
        <?php $form = $this->beginWidget('CActiveForm', array(
            'id' => 'registerForm',
            'enableClientValidation' => true,
            'method' => 'POST',
            'clientOptions' => array(
                'errorCssClass' => 'has-error',
                'validateOnSubmit' => true,
            ),
            'htmlOptions' => array(
                'role' => 'form',
                'class' => 'form-horizontal',
                'enctype' => 'multipart/form-data'
            )
        )); ?>
        <div id="content">
            <table>
                <tr>
                    <td>
                        <?php echo $form->labelEx($model, 'phone', array('class' => 'control-label')); ?>
                    </td>
                    <td>
                        <?php echo $form->textField($model, 'phone', array('class' => 'textbox')); ?>
                    </td>
                </tr>
                <tr>
                    <td>
                        <?php echo $form->labelEx($model, 'ym', array('class' => 'control-label')); ?>
                    </td>
                    <td>
                        <?php echo $form->textField($model, 'ym', array('class' => 'textbox')); ?>
                    </td>
                </tr>

                <tr>
                    <td>
                        <?php echo $form->labelEx($model, 'address', array('class' => 'control-label')); ?>
                    </td>
                    <td>
                        <?php echo $form->textField($model, 'address', array('class' => 'textbox')); ?>
                    </td>
                </tr>

                <tr>
                    <td>
                        <?php echo $form->labelEx($model, 'website', array('class' => 'control-label')); ?>
                    </td>
                    <td>
                        <?php echo $form->textField($model, 'website', array('class' => 'textbox')); ?>
                    </td>
                </tr>

                <tr>
                    <td>
                        <?php echo $form->labelEx($model, 'avatar', array('class' => 'control-label')); ?>
                    </td>
                    <td>
                        <?php echo $form->fileField($model, 'image'); ?>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>    <?php echo CHtml::submitButton('Cập nhật', array('id' => 'btnSaveInformation', 'class' => 'btn btn-default')); ?></td>
                </tr>
            </table>
        </div>
        <?php $this->endWidget(); ?>
    </div>
</div>
</div>
</div>

<div id="vj_right">
    <?php $this->widget('WidgetGuestBook', array('owner_id' => $_GET['user_id'])) ?>
</div>

<script type="text/javascript">
    function change_tg_vn(obj, action, seller, id) {
        closeAllTab();
        var idTab = document.getElementById(obj).id;
        var idShowBox = idTab.replace("tabone", "contenttab");
        document.getElementById(idShowBox).style.display = 'block';
        document.getElementById(idTab).className = 'active_tab_one';
//        getTabInfo(action, seller, id);
    }

    function closeAllTab() {
        for (var i = 1; i < 5; i++) {
            $('#contenttab' + i).attr('style', 'display:none');
            $('#tabone' + i).attr('class', '');
        }
    }
</script>
